/* 接管vuex mapGetters+mapActions 统一处理 */
import { mapGetters, mapActions } from 'vuex'
export const Mixin = {
	computed: {
		...mapGetters([
			'winWidth',
			'winHeight',
			'showTabPanel',
			'bannerData',
			'themeData',
			'isRollVertical',
			'showReadHeaderBar',
			'showReadMenuBar',
			'showToTop',
			'currentReadCID',
			'currentReadSID',
			'currentReadSections',
			'currentReadProgress',
			'showSearchPanel',
			'oldSearchRecords',
			'hotSearchRecords',
			'token',
			'readRecords',
			'collectRecords'
		])
	},
	methods: {
		...mapActions([
			'setWinWidth',
			'setWinHeight',
			'setShowTabPanel',
			'setRollVertical',
			'setShowReadHeaderBar',
			'setShowReadMenuBar',
			'setShowToTop',
			'setCurrentReadCID',
			'setCurrentReadSID',
			'setCurrentReadSections',
			'setCurrentReadProgress',
			'setShowSearchPanel',
			'setOldSearchRecords',
			'setHotSearchRecords',
			'setToken',
			'setReadRecords',
			'setCollectRecords',
			'unSetCollectRecords'
		]),
    
    // 弹出/隐藏 Menu面板
    onMenu() {
      console.log('弹出/隐藏 Menu面板')
      this.setShowTabPanel(!this.showTabPanel)
    },
    
    // 点击搜索
		onSearch() {
			console.log('click search-box')
			this.onShowSearchPanel()
    },
    
    // 点击返回上一级
		onBack() {
			this.$router.go(-1)
    },

    // 隐藏搜索页
    onHiddenSearchPanel() {
    	this.setShowSearchPanel(false)
    },

    // 展开搜索页
    onShowSearchPanel() {
    	this.setShowSearchPanel(true)
    },

    // 展示/隐藏 漫画阅读的控制面板
    onReaderCtrPanel() {
    	this.setShowReadMenuBar(!this.showReadMenuBar)
    	this.setShowReadHeaderBar(!this.showReadHeaderBar)
    }
	}
}